<?php
/**
 * @description
 *  文章详细页面
 *
 * filename : /admin/modules/content/views/content_data_view.php
 * date     : 2009-2-2 18:01
 * author   : hotgun
 * email    : hotgun@163.com
 * 
 * (c)copyright hotgun
 *
 * $Id: /admin/modules/content/views/content_data_view.php,v 1.0 2009-2-2 18:01 $
 */

// 取得返回字符串
$back_url   = strcode(getcookie('back_url'), 'DECODE');
if($back_url == '') $back_url   = $mod_url['li'];


// 处理字符串防止特殊符号引起的错误，
$process_include    = array('article_title', 'sub_title', 'keywords', 'url', 'brief', 'come_from', 'author', 'outer_url', 'hits',
    'seo_title', 'seo_keywords', 'seo_description'
    );
string_pre_process($viewvar, $process_include);

// 如果分类cid未指定，默认分类id为栏目id
if($viewvar['cid'] <= 0) $viewvar['cid'] = $cata;
if($viewvar['cata_order'] >= $G_big_integer || $viewvar['cata_order'] <= 0) $viewvar['cata_order'] = '';
// 创建时间
$viewvar['createtime'] = date(DATE_TIME_FORMAT, $viewvar['createtime']);
// 发布时间
$arr_time   = getdate($viewvar['pub_time']);
$viewvar['pub_date']    = date(DATE_FORMAT, $viewvar['pub_time']);
$viewvar['pub_hour']    = @(int)$arr_time['hours'];
$viewvar['pub_min']     = @(int)$arr_time['minutes'];
$viewvar['pub_sec']     = @(int)$arr_time['seconds'];

// 审核时间
$viewvar['chk_time']    = date(DATE_TIME_FORMAT, $viewvar['chk_time']);

if($_REQUEST['action']!="add")
$chk_display= $viewvar['display'] == 1 ? ' checked' : '';
else
$chk_display='checked';

// 顶
$chk_top    = $viewvar['top'] == 1 ? 'checked' : '';
$chk_guapai    = $viewvar['guapai'] == 1 ? 'checked' : '';

// 附标题
$style_sub_title= 'display:none;';
$chk_sub_title  = '';
if($viewvar['sub_title'] != '') {
    $style_sub_title= 'display:block;';
    $chk_sub_title  = ' checked';
}
// 跳转地址
$style_url  = 'display:none;';
$chk_is_url = '';
if(($viewvar['flag'] & 16) == 16 && $viewvar['url'] != '') {
    if($viewvar['url'] != '') $style_url  = 'display:block;';
    else $viewvar['flag'] = $viewvar['flag']^16;
}
// 附件跳转地址
$style_outeratt = 'display:none;';
$chk_outeratt   = '';
if($viewvar['outeratt'] != '') {
    $style_outeratt = 'display:block;';
    $chk_outeratt   = 'checked';
}

if($cata_info['cata_type'] == 11){
$cata_keylang='通知';
}
if($action == 'modify') {
    $txt_form_title = '修改' . $cata_keylang;
} else {
    $txt_form_title = '新增' . $cata_keylang;
}


if(empty($chk_realname))
    $lab_chk_realname = '<font style=\"color:red\">未审核</font>';
else
    $lab_chk_realname = $chk_realname;


require($abs_admin_cppath . '/header.php');
?>
<link rel="stylesheet" rev="stylesheet" href="<?php echo $url_global['common']; ?>/css/win.css" type="text/css" media="all">
<link rel="stylesheet" rev="stylesheet" href="<?php echo $url_global['common']; ?>/css/win.css" type="text/css" media="all">
<link rel="stylesheet" href="<?php echo $url_global['common']; ?>/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.js"></script>
<script>
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[id="content"]', {
			cssPath : '<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.css',
			uploadJson : '<?php echo $url_global['common']; ?>/kindeditor/php/upload_json.php',
			fileManagerJson : '<?php echo $url_global['common']; ?>/kindeditor/php/file_manager_json.php',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
			}
		});
		prettyPrint();
	});
</script>

<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/win.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/Validator.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/popcalendar.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/jquery-1.3.2.min.js"></SCRIPT>

		<div class="datacontainer2" style="width:90%;">
<div class="header">
<?php echo $txt_form_title ?>
</div>
<form action="<?php echo $mod_url['save'] ?>" method="post" name="article_data" enctype="multipart/form-data" onsubmit="return Validator.Validate(this,3);">
<table BORDER="0" cellpadding="0" cellspacing="0" width="100%" class="list_table">

<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>标题</TD>
	<TD class="cell" colspan="3">
		<input type="text" name="article[article_title]" id="article_title" value="<?php echo $viewvar['article_title']; ?>" class="text" style="width:440px;color:<?php echo $viewvar['tcolor'];?>"

		dataType="Require" dataType="Limit" min="1" max="255" msg="<?php echo $cata_keylang; ?>标题必须填写且必须符合上述规则">
		<span class="mustfill">*</span> 
简题：<input type="text" name="article[simple_title]" value="<?php echo $viewvar['simple_title']; ?>" class="text" style="width:180px">
		<div class="hint"><?php echo $cata_keylang; ?>标题长度为1～255个字符，请不要输入HTML或php代码。<br />
        当正式标题过长，可填写“<B>简题</B>”概要的描述文章标题，避免因某些信息列表只截取标题前少数字符而出现的让人费解的标题。
		</div>
		<!-- 标题颜色：<input type="text" name="article[tcolor]" value="<?php echo $viewvar['tcolor']; ?>" class="text" readonly onfocus="colordialog()">
		&nbsp;&nbsp;
		<input type="checkbox" id="is_sub_title" name="is_sub_title" value="1"  <?php echo $chk_sub_title ?> onclick="dsp_chkbox2div2(this, 'div_sub_title');"><label for="is_sub_title">副标题</label> -->
	</TD>
</TR>
<TR id="div_sub_title" style="<?php echo $style_sub_title ?>">
	<TD width="80" align="right" class="caption">副标题</TD>
	<TD class="cell" colspan="3">
		<input type="text" name="article[sub_title]" value="<?php echo $viewvar['sub_title']; ?>" class="text" style="width:90%"
		
		Require="false" dataType="Limit" max="100" msg="副标题长度不能超过100个字符">
	</TD>
</TR>





<?php
/* +------------------------------------------------------------------------+ */
/**
 * 文章分类相关录入行开始
 * 如果当前栏目类型为单页文章或者为多页文章，不需要选择分类，
 * 指定分类id
 *
 */
if($cata_info['cata_type'] == 1 || $cata_info['cata_type'] == 2) {
    echo '<INPUT TYPE="hidden" NAME="article[cid]" value="'. $cata_info['cid'] .'">';
} else {
    // 含有分类的
?>
<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>分类</TD>
	<TD class="cell" colspan="3">
	<select name="article[cid]" class="select01" onchange="article_class_onchange(this, 'value1', 'div_class_info');<?php echo $defparam_onchange; ?>">
<?php
$thisnode = get_node_info($$class_var, $viewvar['cid']);
echo get_tree_node($cata, $$class_var, $viewvar['cid']);

?>
	</select>
	当前分类：<span id="div_class_info"><?php if($cata <= 0){echo "专属专题";}else{echo tree_node_path_text($thisnode['__node_path']);} ?></span>
	</TD>
</TR>
<?php
}
/* 文章分类相关录入行结束 */
/* +------------------------------------------------------------------------+ */
?>



<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>属性</TD>
	<TD class="cell" colspan="3">
<?php
$icount = 0;
foreach($G_cfg['article_cfg']['article_flag'] as $flagkey => $flagitem) {
    $icount ++;
    $chk_flag = ($viewvar['flag'] & $flagkey) == $flagkey ? 'checked' : '';
    $input_onclick = '';
    if($flagkey == 16) $input_onclick = "onclick=\"dsp_chkbox2div2(this, 'div_url');\"";
?>
<INPUT TYPE="checkbox" NAME="article[flag][]" ID="article_flag_<?php echo $flagkey; ?>" VALUE="<?php echo $flagkey; ?>" <?php echo $chk_flag; ?> <?php echo $input_onclick; ?>> 
<label for="article_flag_<?php echo $flagkey; ?>"><?php echo $flagitem; ?></label>&nbsp;&nbsp;&nbsp;&nbsp;
<?php
    if($icount == 5 || $icount == 8 || $icount == 9 || $icount == 10) {
        echo "<br />";
    }
}
?>
	</TD>
</TR>

<TR id="div_url" style="<?php echo $style_url ?>">
	<TD width="80" align="right" class="caption">跳转至</TD>
	<TD class="cell" colspan="3">
		<input type="text" name="article[url]" value="<?php echo $viewvar['url']; ?>" class="text" style="width:90%"
		
		Require="false" dataType="Limit" max="255" msg="外部跳转URL长度不能超过255个字符">
	</TD>
</TR>


<TR>
	<TD class="submit" colspan="4" align="center">
		<input type="submit" value=" 保存 " class="btn">
		<input type="reset" value=" 重置 " class="btn">
		<input type="button" value=" 返回 " class="btn" onclick="location.href='<?php echo $back_url?>'">
	</TD>
</TR>
<TR>
	<TD colspan="4" class="cell graycell">
<?php
//编辑器
/*require($G_abs_common . '/fckeditor/fckeditor.php');
$oFCKeditor             = new FCKeditor('article[content]') ;
$oFCKeditor->BasePath   = $G_web_common . '/fckeditor/';
$oFCKeditor->UpPath     = '/upload/site/';
$oFCKeditor->Value      = $viewvar['content'];
$oFCKeditor->Width      = '100%';
$oFCKeditor->Height     = 400;
$FCKeditHtml            = $oFCKeditor->CreateHtml() ;
echo $FCKeditHtml;*/
?>
<textarea name="article[content]" id="content" style="width:700px;height:400px;visibility:hidden;"><?php echo htmlspecialchars($viewvar['content']); ?></textarea>
	</TD>
</TR>

<?php if($cata == 3) {?>
<TR>
	<TD width="80" align="right" class="caption">内容摘要</TD>
	<TD class="cell" colspan="3">
<TABLE  width="100%" cellpadding="0" cellspacing="0" class="non_border">
	<TR>
		<TD width="500"><TEXTAREA NAME="article[brief]" ROWS="8" COLS="50" CLASS="area wp98"><?php echo $viewvar['brief']; ?></TEXTAREA></TD>
		<TD><div class="hint">“内容摘要”可能是<?php echo $cata_keylang; ?>的第一段，也可能是<?php echo $cata_keylang; ?>主要内容的说明，用于某些标题＋摘要类<?php echo $cata_keylang; ?>列表的显示。鉴于控制页面显示的原因，请不要加入HTML代码！</div></TD>
	</TR>
</TABLE>
	</TD>
</TR>
<?php }?>
<TR style="display:none;">
	<TD width="80" align="right" class="caption">关键字</TD>
	<TD class="cell" colspan="3">
<input type="text" name="article[keywords]" value="<?php echo $viewvar['keywords']; ?>" class="text" style="width:90%"
		Require="false" dataType="Limit" max="512" msg="关键字长度不能超过512个字符">
<div class="hint">
	“关键字”供站内搜索使用，请用半角逗号隔开！
</div>
	</TD>
</TR>
<?php if($cata!=20){?>
<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>缩略图片</TD>
	<TD class="cell" colspan="2" valign="top" align="left">


<?php
$viewvar['small_image'] = get_upfile_url($viewvar['small_image'], $url_global['common'] . '/images/nopic.jpg');//'common' -> 'admin_theme'
echo get_html_img_record($viewvar['small_images'], 'small_image');
?>
<INPUT TYPE="checkbox" NAME="article[makethumb]" ID="makethumb" VALUE="1" > <label for="makethumb">生成缩略图</label>
宽<input type="text" name="article[makethumbwidth]" value="120" class="text" size="1">X 高<input type="text" name="article[makethumbheight]" value="90" class="text" size="1">
<div class="hint">
	<!-- 考虑到图片变形的因素，请尽量按 <font color="red">245 * 186</font> 的图片或相近比例上传图片！ -->
</div>
	</TD>
	<TD align="left" valign="middle"><img id="obj_small_image" src="<?php echo $viewvar['small_image']; ?>" width="120" height="90"></TD>
</TR>
<?php }else{?>
<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>附件</TD>
	<TD class="cell" colspan="3">
<span id="html_video"><?php
$att    = explode('|', $viewvar['att']);
if(is_array($att)) {
    $icount = 0;
    foreach($att as $v) {
        $v  = trim($v);
        if($v == '') continue;

        $br = $icount > 0 ? '<br>' : '';
        $vfilename  = substr($v, (strrpos($v, '/')+1));
        echo "<input type=\"checkbox\" name=\"article[att][]\" value=\"{$v}\" checked> <a href=\"{$G_web_upload}{$v}\" target=\"_blank\">{$vfilename}</a> <br>";
        $icount ++;
    }
}
?></span>
<iframe src="<?php echo $G_app_root ?>/admin/modules/flashupload/upload_save.php" style="border:none"
width="420" height="30" frameborder="0" framespacing="0" scrolling="NO"></iframe>

<INPUT TYPE="checkbox" NAME="article[chk_outeratt]" ID="outeratt" VALUE="1" <?php echo $chk_outeratt; ?> onclick="return outer_file_url_onclick(this);"> <label for="outeratt">直接输入URL链接</label>
<div id="html_file_url" style="<?php echo $style_outeratt; ?>">
<input type="text" name="article[outeratt]" value="<?php echo $viewvar['outeratt']; ?>" class="text" size="59" style="width:420px;"></div>
<div class="hint">
	仅对下载类栏目有效，此项为<font style="color:red">需要下载的文件</font>上传。
</div>
	</TD>
</TR>
<?php }?>
<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>来源</TD>
	<TD class="cell" width="260">
		<input type="text" name="article[come_from]" value="<?php echo $viewvar['come_from']; ?>" class="text"
		Require="false" dataType="Limit" max="100" msg="<?php echo $cata_keylang; ?>来源不能超过100个字符">
	</TD>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>作者</TD>
	<TD class="cell">
		<input type="text" name="article[author]" value="<?php echo $viewvar['author']; ?>" class="text"
		Require="false" dataType="Limit" max="100" msg="<?php echo $cata_keylang; ?>作者不能超过50个字符">
	</TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption">发布时间</TD>
	<TD class="cell" title="格式：年-月-日" width="260">

	<input type="text" name="article[pub_date]" id="pub_date" value="<?php echo $viewvar['pub_date']; ?>" class="text" size="12" style="font-size:10px">
	<script language=JavaScript>
	<!--
		arrowtag("pub_date",'<?php echo $url_global['common']; ?>/images/datetime.gif');
	//-->
	</script>

	<select name="article[pub_hour]" class="select01" <?php echo $display_pubtime_H; ?>>
	<?php echo get_option_hour($viewvar['pub_hour']); ?>
	</select>:
	<select name="article[pub_min]" class="select01" <?php echo $display_pubtime_i; ?>>
	<?php echo get_option_minute($viewvar['pub_min']); ?>
	</select>:
	<select name="article[pub_sec]" class="select01" <?php echo $display_pubtime_s; ?>>
	<?php echo get_option_second($viewvar['pub_sec']); ?>
	</select>

	</TD>
	<TD width="80">&nbsp;</TD>
	<TD>
	[<?php echo $viewvar['pub_username']; ?>]<?php echo $viewvar['pub_realname']; ?>@<span class="time01"><?php echo $viewvar['createtime']; ?></span>
	<input type="hidden" name="article[pub_userid]" value="<?php echo $viewvar['pub_userid']; ?>"> 

	</TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption">审核</TD>
	<TD class="cell" width="260">
		<label for="valid">审核</label><input type="checkbox" name="article[display]" id="display" value="1" <?php echo $chk_display?> <?php if(!is_su()) echo "disabled=disabled"; ?>> 
	</TD>
	<TD width="80">&nbsp;</TD>
	<TD>
<?php
// + ##############  +//
if($viewvar['display']  == 1) {
// + ##############  +//
if($viewvar['chk_userid'] > 0) {
?>
	[<?php echo $viewvar['chk_username']; ?>]<?php echo $viewvar['chk_realname']; ?>@<span class="time01"><?php echo $viewvar['chk_time']; ?></span>
	<input type="hidden" name="article[chk_username]" value="<?php echo $viewvar['chk_username']; ?>">
	<input type="hidden" name="article[chk_realname]" value="<?php echo $viewvar['chk_realname']; ?>">
	<input type="hidden" name="article[chk_userid]" value="<?php echo $viewvar['chk_userid']; ?>">
<?php
// + ##############  +//
} else {
        echo "已审核@";
}
// + ##############  +//
} else {
    echo "<font style=\"color:#f00\">未审核</font>";
}
?>
	</TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption"><?php echo $cata_keylang; ?>排序</TD>
	<TD class="cell" colspan="3">

		<img src="<?php echo $url_global['common'] ?>/images/hit.gif" title="点击次数">
		点击：<input type="text" name="article[hits]" size="3" value="<?php echo $viewvar['hits']; ?>" 
				
				onkeydown="return non_num_filter();" 
				class="text"
				style="text-align:right;padding-right:2px;"> &nbsp;&nbsp;

		<!-- <label for="article_top">置顶</label>：<INPUT TYPE="checkbox" NAME="article[top]" id="article_top" value="1" <?php echo $chk_top; ?>>  &nbsp;&nbsp; -->
		本栏目内排序：<input type="text" name="article[cata_order]" size="3" value="<?php echo $viewvar['cata_order']; ?>" 
				
				onkeydown="return non_num_filter();" 
				class="text"
				style="text-align:right;padding-right:2px;">
	</TD>
</TR>
<?php
// 看当前分类的根分类有无参数，如果没有参数则不显示自定义参数
if(0 && @$cata_info['__node_path'][0]['defparam'] == 1) {
?>
<TR><TD width="80" align="right" class="caption">自定义参数</TD><TD class="cell" colspan="3" align="top" id="param_html"></TD></TR>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_site['common']; ?>/js/jquery.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_site['common']; ?>/content/js/content.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
var param_ajaxurl = '<?php echo $url_site['common']; ?>/content/ajax.php';
articleparam_list('<?php echo $cid; ?>', '<?php echo $aid; ?>');
//-->
</SCRIPT>
<?php
}
?>
<TR>
	<TD width="80" align="right" class="caption">SEO</TD>
	<TD class="cell" colspan="3">
<TABLE border="0" cellpadding="2" cellspacing="2" width="90%" class="none_border">
<TR>
    <TD width="80" align="right">title：</TD>
    <TD><input type="text" name="article[seo_title]" value="<?php echo $viewvar['seo_title']; ?>" class="text width90pc" Require="false" dataType="Limit" max="255" msg="页面自定义title不能超过255个字符">
<div class="hint">如无特殊需要，请不要填写该信息的title，系统会将页面自动默认为文章标题。</div></TD>
</TR>
<TR>
    <TD width="80" align="right">keywords：</TD>
    <TD><input type="text" name="article[seo_keywords]" value="<?php echo $viewvar['seo_keywords']; ?>" class="text width90pc" Require="false" dataType="Limit" max="255" msg="keywords不能超过255个字符"></TD>
</TR>
<TR>
    <TD width="80" align="right">description：</TD>
    <TD><input type="text" name="article[seo_description]" value="<?php echo $viewvar['seo_description']; ?>" class="text width90pc" Require="false" dataType="Limit" max="255" msg="description不能超过255个字符"></TD>
</TR>
</TABLE>
	</TD>
</TR>


<TR>
	<TD class="submit" colspan="4" align="center">
		<input type="submit" value=" 保存 " class="btn">
		<input type="reset" value=" 重置 " class="btn">
		<input type="button" value=" 返回 " class="btn" onclick="location.href='<?php echo $back_url; ?>'">
		<input type="hidden" name="article[showid]" id="showid" value="<?php echo $viewvar['showid'];?>">
		<input type="hidden" name="article[aid]" value="<?php echo $viewvar['aid']; ?>">
		<input type="hidden" name="article[gsid]" value="<?php echo $viewvar['gsid']; ?>">
		<input type="hidden" name="article[uid]" value="<?php echo $viewvar['uid']; ?>">
		<input type="hidden" name="article[cata]" value="<?php echo $cata; ?>">
		<input type="hidden" name="save" value="<?php echo $save_flag; ?>">
	</TD>
</TR>

</TABLE>
</form>
		</div>
<?php
echo_html_img_js()
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function outer_file_url_onclick(o) {
    var div = GE('html_file_url');
    if(o.checked) {
        div.style.display = 'block';
    } else {
        div.style.display = 'none';
    }
}
//-->
</SCRIPT>
<?php
require($abs_admin_cppath . '/footer.php');
?>